package com.yjhb.android.sbz.v2.mvp.presenter

import com.yjhb.android.sbz.entity.Task
import com.yjhb.android.sbz.http.HttpObserver
import com.yjhb.android.sbz.http.HttpTool
import com.yjhb.android.sbz.v2.mvp.V2ConventionPresenter
import com.yjhb.android.sbz.v2.mvp.view.NowView
import java.util.ArrayList


/**
 *  创建者 zx
 *  创建时间 2021/5/18 13:48
 */
class NowPresenter(view: NowView) : V2ConventionPresenter<NowView>(view) {


    fun getNowTask() {
        model?.let {
            HttpTool.request(it.getNowTask(), object : HttpObserver<ArrayList<Task>?>() {
                override fun onResult(data: ArrayList<Task>?) {
                    data?.let {
                        view?.onLoadSuccess(data)
                    }
                }

                override fun onError(code: Int, msg: String?) {
                    view?.onFailure(code, msg)
                }
            })
        }
    }

}